/*!
 * \file MediaStateBase.h
 * \brief Base class for all states in state machine for
 * media transmission protocol in Media Gateway
 */

#ifndef MGW_MEDIA_STATE_BASE_H
#define MGW_MEDIA_STATE_BASE_H

#include "StateBase.h"
#include "MediaGenerator.h"
#include "MediaEventSetupConnection.h"
#include "MediaEventReleaseConnection.h"

namespace tsc
{
namespace mgw
{

using common::EventData;

/**
 * Base class for media transmission states in Media Gateway
 */
class MediaStateBase : public common::StateBase
{
public:

	/**
	 * Handle specified event for the specified generator.
	 * When the event is handled by state it should be deleted
	 *
	 * \param generator the generator for which the event occurred
	 * \param event the event to handle
	 */
    virtual
	void handleEvent(common::Generator*  generator,
	                 common::EventData*& event);

protected:
	/**
	 * Creates new GAP state with specified name
	 * \param name the name of state
	 */
    MediaStateBase(const char* name);

	virtual ~MediaStateBase();

    virtual void
    handleEventSetupConnection(
        MediaGenerator* gen,
        MediaEventSetupConnection* event,
        EventData*& eventData);

    virtual void
    handleEventReleaseConnection(
        MediaGenerator* gen,
        MediaEventReleaseConnection* event,
        EventData*& eventData);

//    virtual void
//    handleEventGapT711Expired(
//        GapGenerator* gapGen,
//        GapEventT711Expired* event,
//        EventData*& eventData);
};

} // namespace mgw
} // namespace tsc

#endif // MGW_MEDIA_STATE_BASE_H
